package com.ly218wc.springcloud.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: WC
 * @Date: 2020/10/13 17:04
 */
@Configuration
public class GetWayConfig {
    @Bean
    public RouteLocator customerRouteLocator(RouteLocatorBuilder routeLocatorBuilder) {
        RouteLocatorBuilder.Builder routes = routeLocatorBuilder.routes();
        routes.route("path_route_ly218wc", r -> r.path("/guonei").uri("http://news.baidu.com/guonei"))
                .route("path_route_ly218wc2", r -> r.path("/lady").uri("http://news.baidu.com/lady")).build();
        return routes.build();
    }

}
